require "test/unit"
$:.unshift File.dirname(__FILE__) + '/../lib'

require 'Eyealike'


class IndexTestCase < Test::Unit::TestCase
  
  def test_indexing
    
    client = Eyealike.new("V5VF5X79W1OCW6KQBGOM", "kQWhIzEHZjXeAfQozfcb7/AVtmZYjL7rTGIpm+J/", false, "vsp02", 8080)
    
    assert_not_nil(client, message = "Client initialization failed")
    
    request = IndexRequest.new("http://www.superiorpics.com/hs/olivia_thirlby/main1.jpg", "index-test", "index-test", ["1000011d-313d-7b6b-000b-001e0bb9ecc1"])
        
    assert_not_nil(request)
    
    client.unindex(request.url)
    
    response = client.index_real_time(request)
    
    assert_not_nil(response)
    
    assert_not_nil(response.image_url)
    
    assert_not_nil(response.roi_descriptors)
    
    response.roi_descriptors.each do |roi|
      
      assert_not_nil(roi)
      assert_not_nil(roi.roi_id)
      
      puts roi.type_code
      
    end
    
    assert(client.unindex(response.image_url))
    
    
  end
  
  
end